﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CashShop.Bussiness1
{
    /// <summary>
    /// 新增收费满xx立返xx
    /// </summary>
    public class CashReturn : CashSuper
    {
        //满减条件
        private decimal _moneyCondition = 0.0M;
        //满减立返金额
        private decimal _moneyReturn = 0.0M;
        public CashReturn(string moneyCondition,string moneyReturn)
        {
            this._moneyCondition = decimal.Parse(moneyCondition);
            this._moneyReturn = decimal.Parse(moneyReturn);
        }
        public override decimal AcceptCash(decimal money)
        {
            var totalPrice = money;
            if (money > _moneyCondition)
            {
                totalPrice = money - Math.Floor(money / _moneyCondition) * _moneyReturn;
                return totalPrice;
            }
            else
            {
                return totalPrice;
            }
        }
    }
}
